package edu.yzu.testspringboot002.po.dto;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import edu.yzu.testspringboot002.common.group.AddGroup;
import edu.yzu.testspringboot002.common.group.DefaultGroup;
import edu.yzu.testspringboot002.common.group.UpdateGroup;
import edu.yzu.testspringboot002.po.TreeNode;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Null;
import lombok.Data;


import java.io.Serializable;
import java.util.Date;

/**
 * 部门管理
 *
 * @author Mark sunlightcs@gmail.com
 * @since 1.0.0
 */
@Data
@ApiModel(value = "部门管理DTO")
public class SysDeptDTO extends TreeNode<SysDeptDTO> implements Serializable {
	private static final long serialVersionUID = 1L;

	@ApiModelProperty(value = "id")
	@Null(message = "id需要为空", groups = AddGroup.class)
	@NotNull(message = "id 不能为空", groups = UpdateGroup.class)
	private Long id;

	@ApiModelProperty(value = "上级ID")
	@NotNull(message = "上级ID不能为空", groups = DefaultGroup.class)
	private Long pid;

	@ApiModelProperty(value = "部门名称")
	@NotBlank(message = "部门名称不能为空", groups = DefaultGroup.class)
	private String name;

	@ApiModelProperty(value = "排序")
	@Min(value = 0, message = "排序字段不能为空且必须为非负整数", groups = DefaultGroup.class)
	private Integer sort;

	@ApiModelProperty(value = "创建时间")
	@JsonProperty(access = JsonProperty.Access.READ_ONLY)
	private Date createDate;

	@ApiModelProperty(value = "上级部门名称")
	private String parentName;

	@ApiModelProperty(value = "是否末级 0：否 1：是")
	private Integer lastStage;

	// 新增字段
	@ApiModelProperty(value = "外联状态（字典维护 – 外联状态）")
	private String outreachStatus; // 假设为字符串类型，从字典表中获取

	@ApiModelProperty(value = "合作期至")
	@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
	private Date cooperationEndDate; // 合作结束日期

	@ApiModelProperty(value = "联系人")
	@NotBlank(message = "联系人不能为空", groups = DefaultGroup.class) // 根据业务需求添加验证
	private String contactPerson;

	@ApiModelProperty(value = "联系电话")
	@NotBlank(message = "联系电话不能为空", groups = DefaultGroup.class) // 根据业务需求添加验证
	private String contactPhone;

	@ApiModelProperty(value = "专科数")
	@Min(value = 0, message = "专科数必须为非负整数", groups = DefaultGroup.class) // 根据业务需求添加验证
	private Integer specialtyCount;
}